//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Windows.Data;
using OpenLS.Spreadsheet.UI.Internals;

namespace OpenLS.Spreadsheet.UI
{
    [Obsolete]
    class DimensionOffsetObserverFactor: IMultiValueConverter
    {
        #region IMultiValueConverter Members

        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var worksheet = StrictConverter.Convert<Worksheet>(values[0]);
            if (worksheet == null)
                return null;
            int index = StrictConverter.Convert(values[1], 0);
            string s = (string) parameter;
            if (s == "columns")
                return new OffsetObserver(worksheet.Columns[index]);
                return new OffsetObserver(worksheet.Rows[index]);
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotSupportedException();
        }

        #endregion
    }
}
